package weaver.interfaces.haozhi;

import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;

/**
 * 
 * 功能：对库存表做对应库存编码数量的入库
 * @author HaiJiao
 * @Date 2016-12-9
 */
public class AddKcslAction implements Action{

	@Override
	public String execute(RequestInfo request) {
		BaseBean baseBean = new BaseBean();
		RecordSet rs = new RecordSet();
		RecordSet rs1 = new RecordSet();
		//获取表单名称
		String mainTableName = request.getRequestManager().getBillTableName();
		//获取请求id
		String requestId = request.getRequestid();
		baseBean.writeLog("当前表单名字为=============》"+mainTableName);
		baseBean.writeLog("请求id为=============》"+requestId);
		String sql = "";
		String sql1 = "";
		sql = "SELECT * FROM "+mainTableName+" WHERE requestid="+requestId;
		baseBean.writeLog(sql);
		rs.execute(sql);
		if(rs.next()){
			String kcbm = Util.null2String(rs.getString("kcbm"));
			double sl = Util.getDoubleValue(rs.getString("sl"));
			if(kcbm != ""){
				sql1 = "UPDATE uf_kcbd SET sl=sl+"+sl+" WHERE id="+kcbm;
				baseBean.writeLog(sql1);
				rs1.execute(sql1);
			}
		}
		return SUCCESS;
	}

}
